package com.chj.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chj.dao.DictionaryEntityMapper;
import com.chj.entity.DictionaryEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DictionaryService {

    @Autowired
    private DictionaryEntityMapper dictionaryMapper;

    public long addOne(DictionaryEntity dictionary) {
         this.dictionaryMapper.insert(dictionary);
        return dictionary.getId();
    }

    public List<DictionaryEntity> getList() {
        return dictionaryMapper.selectByMap(null);
    }

    public Page<DictionaryEntity> getPage() {
        Page<DictionaryEntity> page = new Page<>();
        return dictionaryMapper.selectPage(page, Wrappers.emptyWrapper());
    }


}
